package com.example.project.entity;

import java.time.LocalDate;
import java.time.LocalDateTime;

import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import com.baomidou.mybatisplus.annotation.TableField;
import com.example.project.annotation.Excel;
import com.example.project.annotation.FieldMeta;
import com.example.project.core.domain.BaseEntity;
import com.fasterxml.jackson.annotation.JsonFormat;

/**
 * 问题，存储项目中的任务、缺陷等问题对象 t_issues
 * 
 * @author ruoyi
 * @date 2025-09-19
 */
public class Issue extends BaseEntity {

	private static final long serialVersionUID = 1L;

	/** 问题ID，主键 */
	private Long id;

	/** 跟踪类型ID */
	@FieldMeta(name = "tracker_id", description = "跟踪")
	@Excel(name = "跟踪类型ID")
	private Long trackerId;

	private Tracker tracker;

	@Excel(name = "跟踪")
	private String trackerName;

	/** 所属项目ID */
	@FieldMeta(name = "project_id", description = "项目")
	@Excel(name = "所属项目ID")
	private Long projectId;

	@Excel(name = "项目")
	private String projectName;

	private Project project;

	/** 问题主题 */
	@FieldMeta(name = "subject", description = "主题")
	@Excel(name = "主题")
	private String subject;

	/** 问题描述 */
	@FieldMeta(name = "description", description = "描述")
	@Excel(name = "描述")
	private String description;

	/** 问题说明 */
	@FieldMeta(name = "notes", description = "说明")
	private String notes;

	/** 截止日期 */
	@FieldMeta(name = "start_date", description = "开始日期")
	@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
	@Excel(name = "开始日期", width = 30, dateFormat = "yyyy-MM-dd")
	private LocalDate startDate;

	/** 截止日期 */
	@FieldMeta(name = "due_date", description = "截止日期")
	@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
	@Excel(name = "截止日期", width = 30, dateFormat = "yyyy-MM-dd")
	private LocalDate dueDate;

	/** 预计时间 */
	@FieldMeta(name = "estimated_hours", description = "预计时间")
	private String estimatedHours;

	/** 分类ID */
	@FieldMeta(name = "category_id", description = "分类")
	private Long categoryId;

	@Excel(name = "分类")
	private String categoryName;

	/** 状态ID */
	@FieldMeta(name = "status_id", description = "状态")
	private Long statusId;

	private IssueStatus issueStatus;

	@Excel(name = "状态")
	private String statusName;

	/** 指派给用户ID */
	@FieldMeta(name = "assigned_to_id", description = "指派给")
	@Excel(name = "指派给用户ID")
	private Long assignedToId;

	@Excel(name = "指派给")
	private String assignedToName;

	/**
	 * 领取人
	 */
	private Long recipient;

	private String recipientName;

	/**
	 * 领取时间
	 */
	private LocalDateTime collectionTime;

	/**
	 * 完工时间
	 */
	private LocalDateTime completionTime;

	/** 优先级ID */
	@FieldMeta(name = "priority_id", description = "优先级")
	@Excel(name = "优先级ID")
	private Long priorityId;

	private IssuePrioritie priority;

	@Excel(name = "优先级")
	private String priorityName;

	/** 修复版本ID */
	@FieldMeta(name = "fixed_version_id", description = "修复版本")
	@Excel(name = "修复版本ID")
	private Long fixedVersionId;

	/** 作者ID */
	@FieldMeta(name = "author_id", description = "作者")
	@Excel(name = "作者ID")
	private Long authorId;

	@Excel(name = "作者")
	private String authorName;

	private String createUser;

	private String updateUser;

	/** 锁定版本（用于并发控制） */
	@FieldMeta(name = "lock_version", description = "锁定版本")
	@Excel(name = "锁定版本", readConverterExp = "用=于并发控制")
	private Long lockVersion;

	/** 任务完成百分比 */
	@FieldMeta(name = "done_ratio", description = "% 进度")
	private Integer doneRatio;

	/** 删除标志（0代表存在 2代表删除） */
	@FieldMeta(name = "del_flag", description = "删除标志（0代表存在 2代表删除）")
	private Long delFlag;

	/**
	 * 开始时间
	 */
	@TableField(exist = false)
	private String sDate;

	/**
	 * 结束时间
	 */
	@TableField(exist = false)
	private String eDate;

	public void setId(Long id) {
		this.id = id;
	}

	public Long getId() {
		return id;
	}

	public void setTrackerId(Long trackerId) {
		this.trackerId = trackerId;
	}

	public Long getTrackerId() {
		return trackerId;
	}

	public void setProjectId(Long projectId) {
		this.projectId = projectId;
	}

	public Long getProjectId() {
		return projectId;
	}

	public void setSubject(String subject) {
		this.subject = subject;
	}

	public String getSubject() {
		return subject;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getDescription() {
		return description;
	}

	public void setDueDate(LocalDate dueDate) {
		this.dueDate = dueDate;
	}

	public LocalDate getDueDate() {
		return dueDate;
	}

	public LocalDate getStartDate() {
		return startDate;
	}

	public void setStartDate(LocalDate startDate) {
		this.startDate = startDate;
	}

	public String getEstimatedHours() {
		return estimatedHours;
	}

	public void setEstimatedHours(String estimatedHours) {
		this.estimatedHours = estimatedHours;
	}

	public void setCategoryId(Long categoryId) {
		this.categoryId = categoryId;
	}

	public Long getCategoryId() {
		return categoryId;
	}

	public void setStatusId(Long statusId) {
		this.statusId = statusId;
	}

	public Long getStatusId() {
		return statusId;
	}

	public void setAssignedToId(Long assignedToId) {
		this.assignedToId = assignedToId;
	}

	public Long getAssignedToId() {
		return assignedToId;
	}

	public void setPriorityId(Long priorityId) {
		this.priorityId = priorityId;
	}

	public Long getPriorityId() {
		return priorityId;
	}

	public void setFixedVersionId(Long fixedVersionId) {
		this.fixedVersionId = fixedVersionId;
	}

	public Long getFixedVersionId() {
		return fixedVersionId;
	}

	public void setAuthorId(Long authorId) {
		this.authorId = authorId;
	}

	public Long getAuthorId() {
		return authorId;
	}

	public void setLockVersion(Long lockVersion) {
		this.lockVersion = lockVersion;
	}

	public Long getLockVersion() {
		return lockVersion;
	}

	public Integer getDoneRatio() {
		return doneRatio;
	}

	public void setDoneRatio(Integer doneRatio) {
		this.doneRatio = doneRatio;
	}

	public void setDelFlag(Long delFlag) {
		this.delFlag = delFlag;
	}

	public Long getDelFlag() {
		return delFlag;
	}

	public Tracker getTracker() {
		return tracker;
	}

	public void setTracker(Tracker tracker) {
		this.tracker = tracker;
	}

	public String getTrackerName() {
		return trackerName;
	}

	public void setTrackerName(String trackerName) {
		this.trackerName = trackerName;
	}

	public String getProjectName() {
		return projectName;
	}

	public void setProjectName(String projectName) {
		this.projectName = projectName;
	}

	public Project getProject() {
		return project;
	}

	public void setProject(Project project) {
		this.project = project;
	}

	public String getCategoryName() {
		return categoryName;
	}

	public void setCategoryName(String categoryName) {
		this.categoryName = categoryName;
	}

	public String getStatusName() {
		return statusName;
	}

	public void setStatusName(String statusName) {
		this.statusName = statusName;
	}

	public String getAssignedToName() {
		return assignedToName;
	}

	public void setAssignedToName(String assignedToName) {
		this.assignedToName = assignedToName;
	}

	public IssuePrioritie getPriority() {
		return priority;
	}

	public void setPriority(IssuePrioritie priority) {
		this.priority = priority;
	}

	public String getPriorityName() {
		return priorityName;
	}

	public void setPriorityName(String priorityName) {
		this.priorityName = priorityName;
	}

	public String getAuthorName() {
		return authorName;
	}

	public void setAuthorName(String authorName) {
		this.authorName = authorName;
	}

	public String getCreateUser() {
		return createUser;
	}

	public void setCreateUser(String createUser) {
		this.createUser = createUser;
	}

	public String getUpdateUser() {
		return updateUser;
	}

	public void setUpdateUser(String updateUser) {
		this.updateUser = updateUser;
	}

	public String getNotes() {
		return notes;
	}

	public void setNotes(String notes) {
		this.notes = notes;
	}

	public String getsDate() {
		return sDate;
	}

	public void setsDate(String sDate) {
		this.sDate = sDate;
	}

	public String geteDate() {
		return eDate;
	}

	public void seteDate(String eDate) {
		this.eDate = eDate;
	}

	public IssueStatus getIssueStatus() {
		return issueStatus;
	}

	public void setIssueStatus(IssueStatus issueStatus) {
		this.issueStatus = issueStatus;
	}

	public Long getRecipient() {
		return recipient;
	}

	public void setRecipient(Long recipient) {
		this.recipient = recipient;
	}

	public String getRecipientName() {
		return recipientName;
	}

	public void setRecipientName(String recipientName) {
		this.recipientName = recipientName;
	}

	public LocalDateTime getCollectionTime() {
		return collectionTime;
	}

	public void setCollectionTime(LocalDateTime collectionTime) {
		this.collectionTime = collectionTime;
	}

	public LocalDateTime getCompletionTime() {
		return completionTime;
	}

	public void setCompletionTime(LocalDateTime completionTime) {
		this.completionTime = completionTime;
	}

	/** 关键词，用于相似度匹配 */
	@TableField("keywords")
	private String keywords;

	/** 类别标签，用于相似度匹配 */
	@TableField("category_tags")
	private String categoryTags;

	public String getKeywords() {
		return keywords;
	}

	public void setKeywords(String keywords) {
		this.keywords = keywords;
	}

	public String getCategoryTags() {
		return categoryTags;
	}

	public void setCategoryTags(String categoryTags) {
		this.categoryTags = categoryTags;
	}

	@Override
	public String toString() {
		return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).append("id", getId())
				.append("trackerId", getTrackerId()).append("projectId", getProjectId()).append("subject", getSubject())
				.append("description", getDescription()).append("dueDate", getDueDate())
				.append("categoryId", getCategoryId()).append("statusId", getStatusId())
				.append("assignedToId", getAssignedToId()).append("priorityId", getPriorityId())
				.append("fixedVersionId", getFixedVersionId()).append("authorId", getAuthorId())
				.append("lockVersion", getLockVersion()).append("delFlag", getDelFlag())
				.append("createBy", getCreateBy()).append("createTime", getCreateTime())
				.append("updateBy", getUpdateBy()).append("updateTime", getUpdateTime())
				.append("keywords", getKeywords()).append("categoryTags", getCategoryTags()).toString();
	}
}
